<template>
    <div>
        <el-breadcrumb separator-class="el-icon-arrow-right">
           <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
           <el-breadcrumb-item>权限管理</el-breadcrumb-item>
           <el-breadcrumb-item>权限列表</el-breadcrumb-item>
        </el-breadcrumb>
        <el-card>
        <el-table :data="rightsList"  border
   style="width: 100%">
   <el-table-column
      type="index"
      label="序号"
      >
    </el-table-column>
    <el-table-column
      prop="authName"
      label="权限名称"
      >
    </el-table-column>
    <el-table-column
      prop="path"
      label="路径"
      >
    </el-table-column>
    <el-table-column
      prop="level"
      label="权限等级"
      >
      <template slot-scope='scopes'>
          <el-tag :type="levelObj[scopes.row.level]['type']">{{levelObj[scopes.row.level]['word']}}</el-tag>
      </template>
    </el-table-column>
  </el-table>
        </el-card>
    </div>
</template>

<script>
export default {
  data () {
    return {
      rightsList: [],
      levelObj: {
        0: {
          type: 'success',
          word: '一级'
        },
        1: {
          type: 'warning',
          word: '二级'
        },
        2: {
          type: 'danger',
          word: '三级'
        }
      }
    }
  },
  created () {
    this.getRightsList()
  },
  methods: {
    async getRightsList () {
    //   获取权限列表
      const data = await this.$http.get('rights/list')
      this.rightsList = data.data
    }
  }
}
</script>

<style lang="less" scoped>
</style>
